import sys


def non_occupied_position(x, y):
 return ( (x == 2) and (y <= 5) ) or ( (y == 4) and (4 <= x <= 8) ) or ((x == 10) and (4 <= y <= 11)) or ((2 <= x <= 8) and (7 <= y <= 8))

arg = sys.stdin.read()

#print "length of input:",len(arg)
#print arg

r = range(0,11)

out = ""

for x in r:
 for y in r:
  v = arg[x*11+y]
  noOc = non_occupied_position(x,y)
  if v == "0" and noOc:
   out += "-"
  elif v == "0":
   out += "0"
  elif noOc:
   out += "!"
  else:
   out += "X"
 out += "\n"

print out
